<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>简易计算器</title>
    <script type="text/javascript">
    function GetValue(){
        //获取输入框的值
        var a = document.getElementById("Num1").value;
        //将变量a的值赋给输入框
        document.getElementById("Result").value = a;
    }

    function SiZYS(Op){
        var _Num1 = parseFloat( document.getElementById("Num1").value);
        var _Num2 = parseFloat(document.getElementById("Num2").value);

        var _Result = 0;

        switch(Op){
            case "+":
                _Result = _Num1 + _Num2;
                break;
            case "-":
                _Result = _Num1 - _Num2;
                break;
            case "*":
                _Result = _Num1 * _Num2;
                break;
            case "/":
                _Result = _Num1 / _Num2;
                break;
        }

        document.getElementById("Result").value = _Result;
    }
    </script>
</head>
<body>
    <table>
        <tr>
            <td>数据一</td>
            <td><input type="text" id="Num1" /></td>
        </tr>
        <tr>
            <td>数据二</td>
            <td><input type="text" id="Num2" /></td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="button" value="获取输入框的值" onclick="GetValue()" />
                <input type="button" value="+" onclick="SiZYS('+')" />
                <input type="button" value="-" onclick="SiZYS('-')" />
                <input type="button" value="*" onclick="SiZYS('*')" />
                <input type="button" value="/" onclick="SiZYS('/')" />
            </td>
        </tr>
        <tr>
            <td>结果</td>
            <td><input type="text" id="Result" /></td></td>
        </tr>
    </table>
</body>
</html>